package appconfig

import (
	"github.com/spf13/viper"
	"log"
)

type Config struct {
	Mysql struct {
		User string
		Pass string
		Host string
		Post int
		Data string
	}
	Redis struct {
		Pass string
		Host string
		Post int
	}
}

var ConfigData Config

func Init() {
	viper.SetConfigFile("appconfig/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		return
	}
	err = viper.Unmarshal(&ConfigData)
	if err != nil {
		return
	}
	log.Println(ConfigData)
}
